/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
#ifndef __FleetFormationGUIMainFrame__
#define __FleetFormationGUIMainFrame__

/**
@file
Subclass of MainFrame, which is generated by wxFormBuilder.
*/

#include "FleetFormationWXGUI.h"
#include "MaCICtrlClient.hpp"
#include "FleetFormationWXGLFrame.hpp"
#include "FleetFormationController.hpp"
#include "ownutils.h"
#include "Component.hpp"
#include "sync.hpp"
class CFleetFormationWXGLFrame;

/** Implementing MainFrame */
class FleetFormationGUIMainFrame : private gim::CSync,
  public MainFrame,
  public Gimbo::CComponent{

 protected:
  // Handlers for MainFrame events.
  void OnSetToFormation( wxCommandEvent& event );
  void OnFollowFleet( wxCommandEvent& event );
  void StaticFormationButton( wxCommandEvent& event );
  void RelativeToMasterHeading( wxCommandEvent& event );
  void OnShowRealPose( wxCommandEvent& event );
 
  void OnServiceAssignment(const Gimbo::TServiceAssignmentList &aServiceList);
 public:
  /** Constructor */
  FleetFormationGUIMainFrame( wxWindow* parent );
  bool Initialize(gimi::GIMI *aGimiPtr, int aGimboID, int aReportID);
  
  
  
 private:


  CFleetFormationWXGLFrame iGlDisplay;

  gimi::GIMI *iGimi;
  MaCI::MaCICtrl::CMaCICtrlClient *iMaCICtrlClient; 
  Gimbo::TServiceAssignmentList iServiceList;
  Gimbo::TServiceAssignmentList iNewServiceList;



  bool iShowRealPose;


  std::map<std::string, SRobotIcon*> iRobotMap;
  
  /// FLEET FORMATION CONTROLLER VARIABLES
  CFleetFormationController iFleetController;
  MaCI::Position::CPositionClient *iMasterPC;
  MaCI::SpeedCtrl::CSpeedCtrlClient *iMasterSC;
  std::map<std::string, MaCI::Position::CPositionClient *> iSlavePC;
  std::map<std::string, MaCI::SpeedCtrl::CSpeedCtrlClient *> iSlaveSC;
  

  void DeleteMachines();
};

#endif // __FleetFormationGUIMainFrame__
